package com.shujia.mr.filter;

import com.shujia.mr.count.MyCountDriver;
import com.shujia.mr.count.MyCountMapper;
import com.shujia.mr.count.MyCountReducer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class MyFilterDriver {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        Configuration conf = new Configuration();

        Job job = Job.getInstance(conf);
        job.setJarByClass(MyFilterDriver.class);
        job.setJobName("filter");

        job.setMapperClass(MyFilterMapper.class);

//        job.setReducerClass(MyFilterReducer.class);

        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(IntWritable.class);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(IntWritable.class);

        FileInputFormat.addInputPath(job,new Path("output/count"));
        FileOutputFormat.setOutputPath(job,new Path("output/filter"));

        job.waitForCompletion(true);
    }
}
